package cn.iocoder.yudao.module.member.dal.mysql.bankaccountinfo;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.bankaccountinfo.vo.BankAccountInfoPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.bankaccountinfo.BankAccountInfoDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 用户转账信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface BankAccountInfoMapper extends BaseMapperX<BankAccountInfoDO> {

    default PageResult<BankAccountInfoDO> selectPage(BankAccountInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BankAccountInfoDO>()
                .eqIfPresent(BankAccountInfoDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BankAccountInfoDO::getName, reqVO.getName())
                .eqIfPresent(BankAccountInfoDO::getMobile, reqVO.getMobile())
                .eqIfPresent(BankAccountInfoDO::getIdNo, reqVO.getIdNo())
                .eqIfPresent(BankAccountInfoDO::getBankId, reqVO.getBankId())
                .likeIfPresent(BankAccountInfoDO::getBankName, reqVO.getBankName())
                .eqIfPresent(BankAccountInfoDO::getBankAddress, reqVO.getBankAddress())
                .betweenIfPresent(BankAccountInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BankAccountInfoDO::getId));
    }

    default List<BankAccountInfoDO> selectListByUserId(Long userId) {
        return selectList(BankAccountInfoDO::getUserId, userId);
    }
}